
/* start /web-platform/scripts/web-platform/social/twittershare.js*/

SOE.TwitterShare=function(){"use strict";this.intents={reply:"tweet?in_reply_to",retweet:"retweet?tweet_id",favorite:"favorite?tweet_id",hashtag:"tweet?hashtags",user:"user?screen_name",follow:"follow?screen_name",sharelink:"tweet?url"};this.addListener();};SOE.TwitterShare.prototype.shareTweet=function(intent,id){"use strict";if(this.intents[intent]&&id){window.open("https://twitter.com/intent/"+this.intents[intent]+"="+encodeURIComponent(id),"twitter","menubar=no,width=500,height=450,toolbar=no");}};SOE.TwitterShare.prototype.addListener=function(){"use strict";$("body").on("click",".twitter-share",function(evt){evt.preventDefault();var $elm=$(evt.currentTarget);var intent=$elm.data("twitter-action");var id=$elm.data("twitter-id");if(intent&&id){this.shareTweet(intent,id);}}.bind(this));};SOE.TwitterShare.parseTimestamp=function(timeStamp){"use strict";var date=new Date(timeStamp);if(_.isNaN(date.getTime())){date=new Date(timeStamp.replace(/( \+)/,"UTC$1"));}
return date;};$(document).ready(function(){"use strict";new SOE.TwitterShare();});

/* end /web-platform/scripts/web-platform/social/twittershare.js*/

/* start /scripts/_pages/home.js*/

var player;var videoID;var goTo=0;var $carouselAnchors;var $carouselItems;var youtubeAPI=document.createElement('script');youtubeAPI.src="//www.youtube.com/iframe_api";var firstScriptTag=document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(youtubeAPI,firstScriptTag);var betaKeyInput=function(){function init(){var $input=$("input.beta-input");var $button=$("a.redeem-link");var _val="";var _postRedeemURL="";var enterCode="ENTER CODE";var alphanum=/^[a-z0-9]+$/i;$input.bind("focus keyup blur keypress",function(event){_val=$input.val();switch(event.type){case"focus":$button.removeClass('disabled');break;case"blur":if(_val==""){$input.val(enterCode).removeClass("active");$button.addClass('disabled');}
break;case"keyup":$input.addClass("active");_val=(_val==enterCode)?"":_val;break;case"keypress":var keycode=(event.keyCode?event.keyCode:(event.which?event.which:event.charCode));if(keycode==13){if(_val!=""&&_val!=enterCode){$button.click();}else{return false;}}
break;}});$button.bind("click",function(event){event.preventDefault();_val=$input.val();_postRedeemURL=globs.urls.camEnterActivationCode+"&ac="+_val;if(_val!=""&&_val!=enterCode){window.location=_postRedeemURL;}});}
return{on:init};}();var carouselAction=function(){if(!$carouselAnchors.eq(goTo).hasClass('vid-link')){window.location=$carouselAnchors.eq(goTo).attr('href');}else{$carouselAnchors.eq(goTo).click();}};var checkPermissions=function(){$.ajax({url:"/rest/does-user-have-permissions.json",cache:"false",dataType:"json",type:"POST",success:function(data){globs.wdl["permissions"]=(data["does-user-have-permission"]=="true")?true:false;if(globs.wdl["permissions"]){$(".beta-banner .beta-reg").html("<p id='closedBetaAccess'>You have Closed Beta access!</p><h1 id='landmarkBeta'>Download Landmark here!</h1><a id='playNow' href='https://launch.soe.com/installer/LM_Beta_setup.exe'></a>");}},error:function(e){Store.log("ERROR: Could not check permissions");}});}
var carouselTimeout;$(document).ready(function(){if(globs.wdl.userLoggedIn==true){checkPermissions();}
betaKeyInput.on();$carouselAnchors=$('a.cta');$carouselItems=$('#homeCarousel .carousel-inner .item');$('#homeCarousel').carousel({interval:5000});$('ol.carousel-indicators li').mouseenter(function(e){carouselTimeout=setTimeout(function(){$(this).addClass('semi-active');goTo=parseInt($(this).attr('data-slide-to'));$('#homeCarousel').carousel('pause').carousel(goTo);}.bind(this),200);}).mouseleave(function(e){clearTimeout(carouselTimeout);$(this).removeClass('semi-active');$('#homeCarousel').carousel('cycle');}).click(function(e){e.preventDefault();carouselAction();});$(".carousel-inner").on("mousedown",".item",function(e){var $this=$(this),label=$this.find("img").attr("src"),action="position: "+$this.data("position");if(typeof ga!=="undefined"){ga("send","event","carousel click",action,label);}});$('#homeCarousel').on('click.bs.carousel',function(e){if(e.target.tagName=='IMG'||e.target.tagName=='P'||e.target.tagName=='DIV'){var cdi=$(this).data('bs.carousel').getActiveIndex();goTo=cdi;carouselAction();}})
$('#videoModal').on('show.bs.modal',function(e){player=new YT.Player('player',{height:'450',width:'550',playerVars:{'autoplay':1,'theme':'dark','color':'black','rel':0,'wmode':'opaque'},videoId:videoID,events:{'onReady':function(ev){ev.target.playVideo();}}});});$('#videoModal').on('hide.bs.modal',function(e){if(player){player.destroy();}});$('a.vid-link').click(function(e){if($(window).width()>=768){e.preventDefault();var idSniff=/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^&?\/ ]{11})/i;videoID=$(this).attr('href').match(idSniff)[1];$($(this).data('target')).modal();}});});var HomePageWidgets=(function(){pub={};var renderWidgets=function(widgets){var $container=$("#widgetsContainer");var markup=[];var feed,k,j,length,col,colHeights=[],height;var cols=(Math.floor($(window).width()/250))>4?4:Math.floor($(window).width()/250);$container.html("");for(k=0;k<cols;k++){$container.append($('<div class="col col-num-'+(k+1)+'">').css("width",100/cols+"%"));markup[k]="";}
length=(widgets.length<(40-(40%cols))?(widgets.length-(widgets.length%cols)):(40-(40%cols)));for(k=0;k<length;k++){height=colHeights[0]||0;for(j=(cols-1);j>-1;j--){if(!colHeights[j]){colHeights[j]=0;}
if(height>=colHeights[j]){col=j;height=colHeights[j];}}
colHeights[col]+=widgets[k].size;markup[col]+=widgets[k].render();}
$columns=$container.find("div.col");$columns.each(function(index){$(this).append(markup[index]);});$(document).trigger("soewidget.renderComplete");};pub.init=function(){var youtube=new SOEWidget.Widget.youtube();var youtubeTemplate=_.template($("#tpl-yt-modal").html());SOEWidget.controller.init({feeds:widgetLists,container:"#widgetsContainer"});$(document).on("soewidget.feedsReady",function(evt,widgets){renderWidgets(widgets.list);});$("#widgetsContainer").on("click",".view-video",function(evt){if($(window).width()>768){evt.preventDefault();var $this=$(this);var id=$this.data("id");if(!$this.parents(".widget").data("has-modal")){youtube.id=id;$('body').append(youtubeTemplate(youtube));$this.parents(".widget").data("has-modal",true);}
$("#ytModal"+id).modal();}});$("body").on("hidden.bs.modal",".modal",function(){try{$(this).find("iframe")[0].contentWindow.postMessage('{"event":"command", "func":"pauseVideo", "args":""}',"*");}catch(e){}});};return pub;})();SOEWidget.Widget.base.prototype.compareTo=function(widget){return widget.timestamp.getTime()-this.timestamp.getTime();};HomePageWidgets.init();

/* end /scripts/_pages/home.js*/

/* start /web-platform/scripts/web-platform/component/global-nav.js*/

(function(){var nonMember=_.template($("script.non-member").html());var member=_.template($("script.member").html());if(globs.wdl.userLoggedIn==true){$.ajax({url:'/get-rest-ticket',type:'POST',data:{type:0},context:this,success:function(sid){$.ajax({url:globs.urls.uramAjaxUrl+"/rest/commerce/11/allaccessinfo.action",dataType:"json",data:{'responseType':"json",'sessionID':sid.successPayload.ticket,},success:function(data){var memberData={scGrantDate:data.scGrantDate,scGrantClaimed:data.scGrantClaimed,mbExpirationDate:data.expirationDate};$('.mb-scBalance').text(data.scBalance);if(data.akella==false){if(data.member==false){$('#mb-all-access').html(nonMember());$('#mb-isMember').text('Try');}else{$('#mb-all-access').html(member(memberData));$('#mb-isMember').text('My');$("#membershipLink").click(function(){window.location.href=globs.urls.membershipMembership;});};}}})}})}else{$('#mb-all-access').html(nonMember());}})();

/* end /web-platform/scripts/web-platform/component/global-nav.js*/
